fn say() {
    let chinese = "世界，你好";
    let english = "World, hello";
    let regions = [chinese, english];
    for item in regions.iter()  {
        println!("{}", &item) // 加不加&有啥区别？
    }
}
fn test_variable() {
    //这样声明的变量为inmmutable的，如果重新赋值需要加mut
    let mut name = "houyw";
    println!("name is: {}", name);
    name = "modified";
    println!("modified name is: {}", name );

    let _unused = "unused"; //未使用的需要加_标识，否则报错

    let (name, mut age) : (&str, i32) = ("houyw", 30);
    println!("name is {:?}, age is {:?}", name, age);
    age = 33;
    println!("name is {name}, modified age is {age}")

    //解构式赋值例子待补充

}
fn test_variable_type() {
    let a : u8 = 255;
    let b = a.wrapping_add(22);
    println!("{}", b);  // 21
}
fn main() {
    say();
    test_variable();
    test_variable_type();

    //注意
    let x = 5u32; //在栈上分配的整型
    // 将 `x` 复制到 `y`——不存在资源移动
    let y = x;
    // 两个值各自都可以使用
    println!("x is {}, and y is {}", x, y);
}
